﻿using EfCoreQuery.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace EfCoreQuery.Config
{
    public class StudentConfig : IEntityTypeConfiguration<Student>
    {
        public void Configure(EntityTypeBuilder<Student> builder)
        {
            builder.ToTable("T_Student").ToTable(t=>t.HasComment("Student_Table")).HasKey(t=>t.Id);
            builder.HasMany(p => p.Teachers).WithMany(p => p.Students).UsingEntity(p => p.ToTable("T_Relation"));
        }
    }
}
